package moodish.server.tests;

import java.util.Vector;

import moodish.comm.IServerComm;
import moodish.comm.IServerSideMessage;
import moodish.server.MyMoodishServer;

/**
 * This simple ServerComm class is just to be used on the tests with a MyMoodishServer object.
 */

public class MyServerComm implements IServerComm{

	public static void main(String args[]){
		MyServerComm msc = new MyServerComm();
		msc.start();
		MyMoodishServer mms = new MyMoodishServer();
		mms.start(msc);
	}
	
	private Vector<IServerSideMessage> _messages = new Vector<IServerSideMessage>();
	
	@Override
	public void start() {
		_messages.add(new MsgConnect("User A"));
		_messages.add(new MsgConnect("User B"));
		_messages.add(new MsgFriendRequest("User A", "User B"));
		_messages.add(new MsgMood("User A", "Testing Mood"));
		
	}

	@Override
	public IServerSideMessage getNextMessage() {
		IServerSideMessage ssm = _messages.get(0);
		_messages.remove(ssm);
		return ssm;
	}

	@Override
	public boolean hasNextMessage() {
		if(_messages.size()==0){
			return false;
		}else{
			return true;
		}
	}

	@Override
	public void sendMoodishMessage(String fromNicename, String toNickname,
			String moodishMessage) {
		// TODO Auto-generated method stub
	}

	@Override
	public void sendNewFriendship(String toNickname, String newFriendship) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendNewUnfriendship(String toNickname, String unfriendship) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendError(String toNickname, String error) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendClientConnected(String toNickname, String connectedNickname) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendClientDisconnected(String toNickname,
			String disconnectedNickname) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean clientIsConnected(String nickname) {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public void disconnectClient(String nickname) {
		// TODO Auto-generated method stub
		
	}
	
}

